package com.haipumi.servlets;

import java.io.File;
import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class InitServlet extends CommonServlet {
	/**
	 * 
	 */
	private static final long serialVersionUID = -175820930181904633L;
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
	}
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
	}
	@Override
	public void init() throws ServletException{
		String path=this.getInitParameter("uploadPath");
		//创建路径
		File file=new File(this.getServletContext().getRealPath(path));
		if(!file.exists()){
			file.mkdirs();
		}
		String backupPath=this.getInitParameter("backupPath");
		//创建路径
		File file1=new File(this.getServletContext().getRealPath(backupPath));
		if(!file1.exists()){
			file1.mkdirs();
		}
		super.init();
	}
}
